package ygflower.domain;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

/**
 * Created by IntelliJ IDEA.
 * User: li
 * Date: 2010-1-21
 * Time: 16:34:23
 * To change this template use File | Settings | File Templates.
 */
@Entity
public class Flower {
	public static String CLASSNAME = "Flower";
	
	public static String PropertyID="id";
	public static String PropertyName="name";
	public static String PropertyMarketPrice="marketPrice";
	public static String PropertyMemberPrice="memberPrice";
	public static String PropertyPicture="picture";
	public static String PropertyUser="User";
	public static String PropertyDescription="description";
	public static String PropertyCreate="create";
	public static String PropertyLastModified="LastModified";
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
    private int id;
    private String name;
    private int marketPrice;
    private int memberPrice;
    private String picture;
    
    @OneToOne(cascade=CascadeType.ALL)
    private User user;
    
    public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Temporal(TemporalType.TIMESTAMP)
	private Date createDate;


	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Transient
	private Date lastModified;

    public Flower() {
    }

    public Flower(String name, int marketPrice, int memberPrice, String picture, String description) {
        this.name = name;
        this.marketPrice = marketPrice;
        this.memberPrice = memberPrice;
        this.picture = picture;
        this.description = description;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getMarketPrice() {
        return marketPrice;
    }

    public void setMarketPrice(int marketPrice) {
        this.marketPrice = marketPrice;
    }

    public int getMemberPrice() {
        return memberPrice;
    }

    public void setMemberPrice(int memberPrice) {
        this.memberPrice = memberPrice;
    }

    public String getPicture() {
        return picture;
    }

    public void setPicture(String picture) {
        this.picture = picture;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    private String description;

}
